<div class="container">
<style>
body{
	overflow-x:hidden;
}
</style>
<div class="ui-portlet-header">
				      <span class="title">提交文章</span>            
				</div>

{{$this->Form->create('Article',array('class'=>'form-horizontal','role'=>'form','id'=>'ArticleAddForm'))}}
<form accept-charset="utf-8"  role="form"  class="form-horizontal" method="post" id="ArticleAddForm" action="{{$this->Html->url('/articles/add.html')}}">
	<div class="form-group">
		<label class="col-sm-2 control-label" for="ArticleName">文章标题</label>
		<div class="col-sm-9 controls">
			{{$this->Form->hidden('id')}}
			{{$this->Form->input('name',array('class'=>'form-control','div'=>false,'label'=>false))}}
		</div>
	</div>
	
	
	<div class="form-group">
		<label class="col-sm-2 control-label" for="ArticlePublished">封面图片</label>
		<div class="col-sm-9 controls select">
			{{$this->Swfupload->load('coverimg',array('modelClass'=>'Article','label'=>false,'isadmin'=>false))}}
		</div>
	</div>
	
	<div class="form-group">
		<label class="col-sm-2 control-label" for="ArticleAuthorname">作者</label>
		<div class="col-sm-9 controls number">
			{{$this->Form->input('authorname',array('class'=>'form-control','div'=>false,'label'=>false))}}
		</div>
	</div>
	<div class="form-group">
		<label class="col-sm-2 control-label" for="ArticleAuthorname">来源</label>
		<div class="col-sm-9 controls number">
			{{$this->Form->input('origin',array('class'=>'form-control','div'=>false,'label'=>false))}}
		</div>
	</div>
	
	<div class="form-group">
		<label class="col-sm-2 control-label" for="ArticleName">文章摘要</label>
		<div class="col-sm-9">
			{{$this->Form->input('summary',array('rows' => '4', 'cols' => '80','class'=>'form-control','div'=>false,'label'=>false))}}
		</div>
	</div>
	
	<div class="form-group">
		<label class="col-sm-2 control-label" for="ArticleName">文章标签</label>
		<div class="col-sm-9 checkboxs">
			<portlet model="Tag" limit="100" info="fields=id,name" showpages="0" return_var="tag_list" return="array"></portlet>
			<?php print_r($tag_list);?>
			{{$this->Form->input('data[Tag][tag_ids][]',array('type'=>'selecte','multipule','class'=>'form-control','div'=>false,'label'=>false))}}
		</div>
	</div>
	
	
	<div class="form-group">
		<label class="col-sm-2 control-label" for="ArticleName">文章内容</label>
		<div class="col-sm-9">
			{{$this->Form->input('content',array('rows' => '4', 'cols' => '80','class'=>'form-control','div'=>false,'label'=>false))}}
		</div>
	</div>
	
	<div class="form-group">
		<label class="col-sm-2 control-label" for="ArticleName"></label>
		<div class="col-sm-9"><input class="btn btn-primary" type="submit" value="提交"></div>
	</div>
</form>

{{$this->Html->script(array(
	'ckeditor/ckeditor.js',
	'swfupload/swfupload.js',
	'swfupload/swfupload.queue.js',
	'swfupload/swfupload.cookies.js',
	'swfupload/fileprogress.js',
	'swfupload/handlers.js',
))}}

<script>
$(function(){
	CKEDITOR.editorConfig = function( config ){
		config.toolbar = 'FRONT';
	}
	ckeditors['ArticleContent'] = CKEDITOR.replace( 'ArticleContent',
		    {
		        customConfig : '{{$this->Html->url("/js/ckeditor/front-config.js")}}'
		    });
	ckeditors['ArticleContent'].on('focus',function(e){
		current_ckeditor_instance = e.editor;
	});
	

	CKEDITOR.on( 'instanceReady', function( e ){
		e.editor.document.appendStyleSheet( '{{$this->Html->url("/stylevars/getcss.css")}}' );
		e.editor.document.appendStyleSheet( '{{$this->Html->url("/css/ui-customer.css")}}' );
		//e.editor.setMode( 'source' );
		e.editor.on( 'mode', function( e ){
			if(e.editor.mode == 'wysiwyg'){
				e.editor.document.appendStyleSheet( '{{$this->Html->url("/stylevars/getcss.css")}}' );
				e.editor.document.appendStyleSheet( '{{$this->Html->url("/css/ui-customer.css")}}' );
			}
		});
		//if($('.cke_top').parent('ui-dialog-content').size()<1){
		//	$('.cke_top').addClass('clearfix').affix();
		//}
	});
})
</script>
</div>